package library;

public class Book {
    //书名
    private String BookName;
    //作者
    private String Author;
    //价格
    private double price;
    //书的类型
    private String Type;
    //是否借出
    private Boolean isBorrowed;

    //构造方法
    public Book(String bookName, String author, double price, String type, Boolean isBorrowed) {
        this.BookName = bookName;
        this.Author = author;
        this.price = price;
        this.Type = type;
        this.isBorrowed = isBorrowed;//初始状态下未借出
    }

    public void setBookName(String bookName) {
        BookName = bookName;
    }

    public void setAuthor(String author) {
        Author = author;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public void setType(String type) {
        Type = type;
    }

    public void setBorrowed(Boolean borrowed) {
        isBorrowed = borrowed;
    }

    public String getBookName() {
        return BookName;
    }

    public String getAuthor() {
        return Author;
    }

    public double getPrice() {
        return price;
    }

    public String getType() {
        return Type;
    }

    public Boolean isBorrowed() {//只有属性为boolean类型才可以用is前缀
        return isBorrowed;
    }

    @Override
    public String toString() {
        return "{" +
                "BookName='" + BookName + '\'' +
                ", Author='" + Author + '\'' +
                ", price=" + price +
                ", Type='" + Type + '\'' +
                ", isBorrowed=" + (isBorrowed?"借出":"未借出") +
                '}';
    }
}
